#ifndef CONFIGUREVIEWERWIDGET_H
#define CONFIGUREVIEWERWIDGET_H

#include "Layer.hpp"
#include <qwidget.h>
#include <qpushbutton.h>
#include <qcombobox.h>
#include <qlayout.h>

#include "GrayImage.hpp"
#include "BinaryImage.hpp"
#include "Gradiant.hpp"
#include "OutlineContainer.hpp"

#include "Operator.hpp"
#include "ThresholdFinder.hpp"
#include "LinkerOperator.hpp"
#include "OutlineClosingOperator.hpp"
#include "SegmentModelizerOperator.hpp"
#include "Mask.hpp"

#include "Gui/LayerViewerWidget.hpp"
#include "Gui/SegmentViewerWidget.hpp"
#include "Gui/HistogramViewerWidget.hpp"

#define QT_VERSION_33
//#define QT_VERSION_43
class ConfigureViewerWidget : public QWidget
{
    Q_OBJECT
public:
        //----------------------------------------------------------------------
        // Constructeur
        //----------------------------------------------------------------------
        ConfigureViewerWidget( );

        //----------------------------------------------------------------------
        // Destructeur
        //----------------------------------------------------------------------
        virtual ~ConfigureViewerWidget();

public slots:
	void CreateImagePipeline();

protected:

	//----------------------------------------------------------------------
	//
	//----------------------------------------------------------------------
	ImageAnalysis::GrayImage* LoadImage();
	ImageAnalysis::Mask** LoadMask();

	void SaveImage();
	void DeleteImagePipeline();
	void LoadMaskPipeline();

	//----------------------------------------------------------------------
	// Comopsant liste pour les choix de l'utilisateur
	//----------------------------------------------------------------------
	QPushButton* loadImagePushButton;
	QComboBox* thresholdOperatorComboBox;
	QComboBox* thresholdFinderComboBox;
	QComboBox* maskComboBox;
	QComboBox* closingComboBox;
	QComboBox* modelisingComboBox;
	QHBoxLayout* layout;

	//----------------------------------------------------------------------
	// Composant de visualisation
	//----------------------------------------------------------------------
	LayerViewerWidget* imageWidget;
	LayerViewerWidget* gradiantWidget;
	LayerViewerWidget* thresholdWidget;
	LayerViewerWidget* refineWidget;	
	LayerViewerWidget* closeWidget;
	SegmentViewerWidget* modelWidget;

	HistogramViewerWidget* histogramWidget;
	ImageAnalysis::Histogram* gradiantHistogram;

	//----------------------------------------------------------------------
	//
	//----------------------------------------------------------------------
	ImageAnalysis::GrayImage* originalImage;
	ImageAnalysis::Gradiant* gradiantImage;
	ImageAnalysis::BinaryImage* thresholdedImage;
	ImageAnalysis::BinaryImage* refinedImage;	
	ImageAnalysis::RGBImage* closedImage;
	ImageAnalysis::OutlineContainer* closedOutlineContainer;
	ImageAnalysis::SegmentContainer::TSegmentContainerList* modelizedOutlineContainer;
	

	//----------------------------------------------------------------------
	//
	//----------------------------------------------------------------------
	int numberOfMask;
	ImageAnalysis::Mask** masks;
	ImageAnalysis::Operator* thresholdOperator;
	ImageAnalysis::ThresholdFinder* thresholdFinder;
	ImageAnalysis::Operator* refineOperator;
	ImageAnalysis::Operator* convolutionOperator;
	ImageAnalysis::Operator* linkerOperator;
	ImageAnalysis::Operator* closingOperator;
	ImageAnalysis::Operator* modelerOperator;
};

#endif //CONFIGUREVIEWERWIDGET_H
